home *** CD-ROM | disk | FTP | other *** search
- //Compare and update the files in <Dir1> and <Dir2>.
- //Backup overwrited file to <BackupChanges>.
- const Directory2Backup = 'c:\FoldertoBackup\';
- ZipDirectory = 'c:\BackupTo\';
- var
- Path1,ZipPath : String;
- var aForm : TForm;
- Button1,Button2,ConfirmButton : TButton;
- Edit1,Edit2 : TEdit;
- Label1,Label2 : TLabel;
- procedure Button1Click(sender: TObject);
- var k : string;
- begin
- k := AskDirDialog(Edit1.text);
- if k <> '' then
- Edit1.text := k;
- end;
- procedure Button2Click(sender: TObject);
- var k : string;
- begin
- k := AskDirDialog(Edit2.text);
- if k <> '' then
- Edit2.text := k;
- end;
-
- procedure Continueclick(sender: TObject);
- begin
- aForm.Close;
- end;
- function AskDirectory : boolean;
- begin
- Result := False;
- aForm := New_Form(100,100,500,200,'Please Configure and press Continue');
- Label1 := new_Label(aForm,10,10,'Directory to Backup : ');
- Edit1 := new_Edit(aForm,120,10,200,20,Directory2Backup);
- Button1 := New_Button(aForm, 350, 10, 100, 20, 'Browse');
- Button1.OnClick := @Button1Click;
- Label2 := new_Label(aForm,10,40,'Zip Directory : ');
- Edit2 := new_Edit(aForm,120,40,200,20,ZipDirectory);
- Button2 := New_Button(aForm, 350, 40, 100, 20, 'Browse');
- Button2.OnClick := @Button2Click;
- ConfirmButton := New_Button(aForm, 350, 130, 100, 30, 'Continue');
- ConfirmButton.Default := True;
- ConfirmButton.ModalResult := mrOK;
- ConfirmButton.OnClick := @Continueclick;
- show_Form(aForm);
- if aForm.modalResult = Mrok then
- begin
- Path1 := AppendSlash(Edit1.text);
- ZipPath := AppendSlash(Edit2.text);
- Result := true;
- end;
- end;
-
- procedure ReWritepath;
- var k : string;
- ts : TStringlist;
- begin
- k := AskFilenameDialog('c:\Relative.akp','Akp Script|*.akp');
- if k <> '' then
- begin
- ts := TStringlist.create;
- if fileexists(programpath+'Scripts\Relative.akp') then
- ts.loadfromfile(programpath+'Scripts\Relative.akp');
- ts.strings[2] := 'const Directory2Backup='''+path1+''';';
- ts.strings[3] := ' ZipDirectory='''+ZipPath+''';';
- MakeDir(ZipPath);
- ts.savetofile(k);
- ts.free;
- end;
-
- end;
-
- begin
- if AskDirectory then
- ReWritepath;
- Writeln('Completed!');
- end.
-